using System;

namespace RapidHDL
{
	/// <summary>
	/// Summary description for ExternalTool.
	/// </summary>
	public class ExternalTool
	{
		System.Collections.Hashtable oParameters;
		string sExecutionDirectory;
		string sWorkingDirectory;
		string sExecutable;
		string sCommandLine;

		public ExternalTool()
		{
			oParameters = new System.Collections.Hashtable();
			sExecutionDirectory = "";
			sWorkingDirectory = "";
			sExecutable = "";
		}

		private string BuildCommandLine()
		{
			string sParameter;
			if (!sExecutionDirectory.EndsWith("\\")
				sExecutionDirectory += "\\";

			sCommandLine = sExecutionDirectory + sExecutable;
			foreach(string sParameter in oParameters)
			{
				//sCommandLine += " " 
			}
			return sCommandLine;
		}

		public void Execute()
		{
			System.Diagnostics.Process proc = new System.Diagnostics.Process();
			proc.StartInfo.UseShellExecute = false;  
			proc.StartInfo.RedirectStandardOutput = false;  // was true
			proc.StartInfo.WorkingDirectory = sWorkingDirectory;
			proc.StartInfo.CreateNoWindow=false;     // was true
			proc.EnableRaisingEvents=false;
			proc.StartInfo.FileName=BuildCommandLine();
			proc.Start();
		}		
	}
}
